args <- commandArgs(TRUE)

inputfile <- args[1]
outputfile <- args[2]

data <- read.table(file=inputfile, sep='\t', quote="", comment.char="")
data <- data[, -21]
rows <- nrow(data)
cols <- ncol(data)

for (i in 1:rows) {
	norm <- sum(data[i, ])
	data[i, ] <- data[i, ] / norm
}

data <- t(data)

colors <- rainbow(cols)

title <- "Normalized Work Archetype Cluster Centers"
xlabel <- "Work Archetype Cluster"
ylabel <- "Cluster Center"
xnames <- as.character(1:rows)

png(outputfile, width=600, height=600, units="px")
fontsize=2.0

barplot(data, main=title, xlab=xlabel, ylab=ylabel, names.arg=xnames, col=colors, cex.lab=fontsize, cex.axis=fontsize, cex.main=fontsize, cex.sub=fontsize)

dev.off()


